home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / parsers / NonValidatingDOMParser.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  11.8 KB  |  666 lines

  1. package com.ibm.xml.parsers;
  2.  
  3. import com.ibm.xml.dom.AttrImpl;
  4. import com.ibm.xml.dom.DeferredDocumentImpl;
  5. import com.ibm.xml.dom.DocumentImpl;
  6. import com.ibm.xml.dom.DocumentTypeImpl;
  7. import com.ibm.xml.dom.ElementDefinitionImpl;
  8. import com.ibm.xml.dom.EntityImpl;
  9. import com.ibm.xml.dom.NodeImpl;
  10. import com.ibm.xml.dom.TextImpl;
  11. import com.ibm.xml.framework.AttrPool;
  12. import com.ibm.xml.framework.ElementDeclPool;
  13. import com.ibm.xml.framework.EntityPool;
  14. import com.ibm.xml.framework.ParserState;
  15. import com.ibm.xml.framework.StringPool;
  16. import com.ibm.xml.framework.XMLParser;
  17. import java.io.IOException;
  18. import java.util.Stack;
  19. import org.w3c.dom.Comment;
  20. import org.w3c.dom.Document;
  21. import org.w3c.dom.DocumentType;
  22. import org.w3c.dom.Element;
  23. import org.w3c.dom.Entity;
  24. import org.w3c.dom.EntityReference;
  25. import org.w3c.dom.NamedNodeMap;
  26. import org.w3c.dom.Node;
  27. import org.w3c.dom.NodeList;
  28. import org.w3c.dom.Notation;
  29. import org.w3c.dom.ProcessingInstruction;
  30. import org.w3c.dom.Text;
  31. import org.xml.sax.AttributeList;
  32. import org.xml.sax.InputSource;
  33. import org.xml.sax.SAXException;
  34.  
  35. public class NonValidatingDOMParser extends XMLParser {
  36.    public static final int FULL = 0;
  37.    public static final int DEFERRED = 1;
  38.    public static final String DEFAULT_DOCUMENT_CLASS;
  39.    private static final boolean DEBUG_ATTLIST_DECL = false;
  40.    protected int fDocumentIndex = -1;
  41.    protected int fDocumentTypeIndex = -1;
  42.    protected int fCurrentNodeIndex = -1;
  43.    protected DocumentType fDocumentType;
  44.    protected Node fCurrentNode;
  45.    protected Stack fNodeStack = new Stack();
  46.    protected Document fDocument;
  47.    protected DocumentImpl fDocumentImpl;
  48.    protected DeferredDocumentImpl fDeferredDocumentImpl;
  49.    protected boolean fExpandEntityReferences = false;
  50.    protected int fNodeExpansion = 1;
  51.    protected boolean fWithinElement = false;
  52.    int fAmpIndex = -1;
  53.    int fLtIndex = -1;
  54.    int fGtIndex = -1;
  55.    int fAposIndex = -1;
  56.    int fQuotIndex = -1;
  57.    protected AttrPool fAttrPool;
  58.    protected ElementDeclPool fElementDeclPool;
  59.    protected EntityPool fEntityPool;
  60.    protected StringPool fStringPool;
  61.    protected String fDocumentClass;
  62.    protected boolean fRootElement;
  63.    private int[] nodestack;
  64.    private int stacktop;
  65.    // $FF: synthetic field
  66.    static Class class$com$ibm$xml$dom$DocumentImpl;
  67.  
  68.    public NonValidatingDOMParser() {
  69.       this.fDocumentClass = DEFAULT_DOCUMENT_CLASS;
  70.       this.nodestack = new int[16];
  71.       ((XMLParser)this).setDocumentHandler(this);
  72.       ((XMLParser)this).setDocumentTypeHandler(this);
  73.       this.fExpandEntityReferences = false;
  74.       this.fNodeExpansion = 1;
  75.       ParserState var1 = ((XMLParser)this).getParserState();
  76.       var1.useDefaultStringPool();
  77.       var1.useDefaultAttrPool();
  78.       var1.useDefaultEntityPool();
  79.       var1.useDefaultElementDeclPool();
  80.       this.init(var1);
  81.    }
  82.  
  83.    public void reset() {
  84.       super.reset();
  85.       this.init(((XMLParser)this).getParserState());
  86.    }
  87.  
  88.    protected void resetOrCopy() {
  89.       super.resetOrCopy();
  90.       this.init(((XMLParser)this).getParserState());
  91.    }
  92.  
  93.    protected void init(ParserState var1) {
  94.       this.fDocumentType = null;
  95.       this.fCurrentNode = null;
  96.       this.fNodeStack.removeAllElements();
  97.       this.fDocumentIndex = -1;
  98.       this.fDocumentTypeIndex = -1;
  99.       this.fCurrentNodeIndex = -1;
  100.       this.fDocumentImpl = null;
  101.       this.fDocument = null;
  102.       this.fWithinElement = false;
  103.       this.fAttrPool = var1.getAttrPool();
  104.       this.fElementDeclPool = var1.getElementDeclPool();
  105.       this.fEntityPool = var1.getEntityPool();
  106.       this.fStringPool = var1.getStringPool();
  107.       this.fAmpIndex = this.fStringPool.addSymbol("amp");
  108.       this.fLtIndex = this.fStringPool.addSymbol("lt");
  109.       this.fGtIndex = this.fStringPool.addSymbol("gt");
  110.       this.fAposIndex = this.fStringPool.addSymbol("apos");
  111.       this.fQuotIndex = this.fStringPool.addSymbol("quot");
  112.    }
  113.  
  114.    protected void checkHandlers() throws Exception {
  115.       super.checkHandlers();
  116.    }
  117.  
  118.    public void setExpandEntityReferences(boolean var1) {
  119.       this.fExpandEntityReferences = var1;
  120.    }
  121.  
  122.    public boolean getExpandEntityReferences() {
  123.       return this.fExpandEntityReferences;
  124.    }
  125.  
  126.    public void setNodeExpansion(int var1) {
  127.       if (var1 != 0 && var1 != 1) {
  128.          this.fNodeExpansion = 1;
  129.       } else {
  130.          this.fNodeExpansion = var1;
  131.       }
  132.    }
  133.  
  134.    public int getNodeExpansion() {
  135.       return this.fNodeExpansion;
  136.    }
  137.  
  138.    public Node getCurrentNode() {
  139.       return this.fCurrentNode;
  140.    }
  141.  
  142.    public void doctypeDecl(int var1) throws Exception {
  143.       if (this.fNodeExpansion == 0) {
  144.          if (this.fDocumentImpl != null) {
  145.             String var2 = this.fStringPool.toString(var1);
  146.             this.fDocumentType = this.fDocumentImpl.createDocumentType(var2);
  147.             this.fDocumentImpl.appendChild(this.fDocumentType);
  148.             this.fCurrentNode = this.fDocumentType;
  149.             return;
  150.          }
  151.       } else if (this.fNodeExpansion == 1) {
  152.          this.fDocumentTypeIndex = this.fDeferredDocumentImpl.createDocumentType(var1);
  153.          this.fDeferredDocumentImpl.appendChild(this.fDocumentIndex, this.fDocumentTypeIndex);
  154.          this.fCurrentNodeIndex = this.fDocumentTypeIndex;
  155.       }
  156.  
  157.    }
  158.  
  159.    public void startInternalSubset() throws Exception {
  160.    }
  161.  
  162.    public void endInternalSubset() throws Exception {
  163.       if (this.fNodeExpansion == 0) {
  164.          this.fCurrentNode = this.fDocument;
  165.       } else {
  166.          if (this.fNodeExpansion == 1) {
  167.             this.fCurrentNodeIndex = this.fDocumentIndex;
  168.          }
  169.  
  170.       }
  171.    }
  172.  
  173.    public void startExternalSubset(int var1, int var2) throws Exception {
  174.       if (this.fNodeExpansion == 0) {
  175.          this.fCurrentNode = this.fDocumentType;
  176.       } else {
  177.          if (this.fNodeExpansion == 1) {
  178.             this.fCurrentNodeIndex = this.fDocumentTypeIndex;
  179.          }
  180.  
  181.       }
  182.    }
  183.  
  184.    public void endExternalSubset() throws Exception {
  185.       if (this.fNodeExpansion == 0) {
  186.          this.fCurrentNode = this.fDocument;
  187.       } else {
  188.          if (this.fNodeExpansion == 1) {
  189.             this.fCurrentNodeIndex = this.fDocumentIndex;
  190.          }
  191.  
  192.       }
  193.    }
  194.  
  195.    public void elementDecl(int var1) throws Exception {
  196.    }
  197.  
  198.    public void attlistDecl(int var1, int var2) throws Exception {
  199.       if (this.fNodeExpansion == 0) {
  200.          if (this.fDocumentImpl != null) {
  201.             int var3 = this.fElementDeclPool.getAttValue(var2);
  202.             if (var3 != -1) {
  203.                int var4 = this.fElementDeclPool.getElementName(var1);
  204.                String var5 = this.fStringPool.toString(var4);
  205.                NamedNodeMap var6 = ((DocumentTypeImpl)this.fDocumentType).getElements();
  206.                ElementDefinitionImpl var7 = (ElementDefinitionImpl)var6.getNamedItem(var5);
  207.                if (var7 == null) {
  208.                   var7 = this.fDocumentImpl.createElementDefinition(var5);
  209.                   ((DocumentTypeImpl)this.fDocumentType).getElements().setNamedItem(var7);
  210.                }
  211.  
  212.                int var8 = this.fElementDeclPool.getAttName(var2);
  213.                String var9 = this.fStringPool.toString(var8);
  214.                String var10 = this.fStringPool.toString(var3);
  215.                AttrImpl var11 = (AttrImpl)this.fDocumentImpl.createAttribute(var9);
  216.                var11.setValue(var10);
  217.                var11.setSpecified(false);
  218.                var7.getAttributes().setNamedItem(var11);
  219.                return;
  220.             }
  221.          }
  222.       } else if (this.fNodeExpansion == 1) {
  223.          int var12 = this.fElementDeclPool.getAttValue(var2);
  224.          if (var12 != -1) {
  225.             int var13 = this.fElementDeclPool.getElementName(var1);
  226.             int var14 = this.fDeferredDocumentImpl.lookupElementDefinition(var13);
  227.             if (var14 == -1) {
  228.                var14 = this.fDeferredDocumentImpl.createElementDefinition(var13);
  229.                this.fDeferredDocumentImpl.appendChild(this.fDocumentTypeIndex, var14);
  230.             }
  231.  
  232.             int var15 = this.fElementDeclPool.getAttName(var2);
  233.             int var16 = this.fDeferredDocumentImpl.createAttribute(var15, var12, false);
  234.             this.fDeferredDocumentImpl.appendChild(var14, var16);
  235.          }
  236.       }
  237.  
  238.    }
  239.  
  240.    public void internalEntityDecl(int var1) throws Exception {
  241.       int var2 = this.fEntityPool.getEntityName(var1);
  242.       if (this.fNodeExpansion == 0) {
  243.          if (this.fDocumentImpl != null) {
  244.             if (this.fDocumentType == null) {
  245.                return;
  246.             }
  247.  
  248.             Entity var3 = this.fDocumentImpl.createEntity(this.fStringPool.toString(var2));
  249.             this.fDocumentType.getEntities().setNamedItem(var3);
  250.             return;
  251.          }
  252.       } else if (this.fNodeExpansion == 1) {
  253.          if (this.fDocumentTypeIndex == -1) {
  254.             return;
  255.          }
  256.  
  257.          int var4 = this.fDeferredDocumentImpl.createEntity(var1);
  258.          this.fDeferredDocumentImpl.appendChild(this.fDocumentTypeIndex, var4);
  259.       }
  260.  
  261.    }
  262.  
  263.    public void externalEntityDecl(int var1) throws Exception {
  264.       int var2 = this.fEntityPool.getEntityName(var1);
  265.       int var3 = this.fEntityPool.getPublicId(var1);
  266.       int var4 = this.fEntityPool.getSystemId(var1);
  267.       if (this.fNodeExpansion == 0) {
  268.          if (this.fDocumentImpl != null) {
  269.             if (this.fDocumentType == null) {
  270.                return;
  271.             }
  272.  
  273.             EntityImpl var5 = (EntityImpl)this.fDocumentImpl.createEntity(this.fStringPool.toString(var2));
  274.             var5.setPublicId(this.fStringPool.toString(var3));
  275.             var5.setSystemId(this.fStringPool.toString(var4));
  276.             this.fDocumentType.getEntities().setNamedItem(var5);
  277.             return;
  278.          }
  279.       } else if (this.fNodeExpansion == 1) {
  280.          if (this.fDocumentTypeIndex == -1) {
  281.             return;
  282.          }
  283.  
  284.          int var6 = this.fDeferredDocumentImpl.createEntity(var1);
  285.          this.fDeferredDocumentImpl.appendChild(this.fDocumentTypeIndex, var6);
  286.       }
  287.  
  288.    }
  289.  
  290.    public void unparsedEntityDecl(int var1) throws Exception {
  291.       int var2 = this.fEntityPool.getEntityName(var1);
  292.       int var3 = this.fEntityPool.getPublicId(var1);
  293.       int var4 = this.fEntityPool.getSystemId(var1);
  294.       int var5 = this.fEntityPool.getNotationName(var1);
  295.       if (this.fNodeExpansion == 0) {
  296.          if (this.fDocumentImpl != null) {
  297.             if (this.fDocumentType == null) {
  298.                return;
  299.             }
  300.  
  301.             EntityImpl var6 = (EntityImpl)this.fDocumentImpl.createEntity(this.fStringPool.toString(var2));
  302.             var6.setPublicId(this.fStringPool.toString(var3));
  303.             var6.setSystemId(this.fStringPool.toString(var4));
  304.             var6.setNotationName(this.fStringPool.toString(var5));
  305.             this.fDocumentType.getEntities().setNamedItem(var6);
  306.             return;
  307.          }
  308.       } else if (this.fNodeExpansion == 1) {
  309.          if (this.fDocumentTypeIndex == -1) {
  310.             return;
  311.          }
  312.  
  313.          int var7 = this.fDeferredDocumentImpl.createEntity(var1);
  314.          this.fDeferredDocumentImpl.appendChild(this.fDocumentTypeIndex, var7);
  315.       }
  316.  
  317.    }
  318.  
  319.    public void notationDecl(int var1) throws Exception {
  320.       int var2 = this.fEntityPool.getEntityName(var1);
  321.       if (this.fNodeExpansion == 0) {
  322.          if (this.fDocumentImpl != null) {
  323.             if (this.fDocumentType == null) {
  324.                return;
  325.             }
  326.  
  327.             Notation var3 = this.fDocumentImpl.createNotation(this.fStringPool.toString(var2));
  328.             this.fDocumentType.getNotations().setNamedItem(var3);
  329.             return;
  330.          }
  331.       } else if (this.fNodeExpansion == 1) {
  332.          if (this.fDocumentTypeIndex == -1) {
  333.             return;
  334.          }
  335.  
  336.          int var4 = this.fDeferredDocumentImpl.createNotation(var1);
  337.          this.fDeferredDocumentImpl.appendChild(this.fDocumentTypeIndex, var4);
  338.       }
  339.  
  340.    }
  341.  
  342.    public void parameterEntityDecl(int var1) {
  343.    }
  344.  
  345.    public void setDocumentClass(String var1) {
  346.       if (var1 == null) {
  347.          var1 = DEFAULT_DOCUMENT_CLASS;
  348.       }
  349.  
  350.       this.fDocumentClass = var1;
  351.       if (!var1.equals(DEFAULT_DOCUMENT_CLASS)) {
  352.          this.setNodeExpansion(0);
  353.       }
  354.  
  355.    }
  356.  
  357.    public Document getDocument() {
  358.       return this.fDocument;
  359.    }
  360.  
  361.    public void startDocument(int var1, int var2, int var3) {
  362.       if (var1 != -1) {
  363.          this.fStringPool.orphanString(var1);
  364.       }
  365.  
  366.       if (var2 != -1) {
  367.          this.fStringPool.orphanString(var2);
  368.       }
  369.  
  370.       if (var3 != -1) {
  371.          this.fStringPool.orphanString(var3);
  372.       }
  373.  
  374.       if (this.fNodeExpansion == 0) {
  375.          try {
  376.             this.fDocument = (Document)Class.forName(this.fDocumentClass).newInstance();
  377.             if (this.fDocument instanceof DocumentImpl) {
  378.                this.fDocumentImpl = (DocumentImpl)this.fDocument;
  379.             }
  380.          } catch (Exception var4) {
  381.          }
  382.  
  383.          this.fCurrentNode = this.fDocument;
  384.       } else {
  385.          if (this.fNodeExpansion == 1) {
  386.             this.fDocumentImpl = this.fDeferredDocumentImpl = new DeferredDocumentImpl(((XMLParser)this).getParserState());
  387.             this.fDocument = this.fDocumentImpl;
  388.             this.fDocumentIndex = this.fDeferredDocumentImpl.createDocument();
  389.             this.fCurrentNodeIndex = this.fDocumentIndex;
  390.          }
  391.  
  392.       }
  393.    }
  394.  
  395.    public void endDocument() throws Exception {
  396.    }
  397.  
  398.    public void startElement(int var1, int var2) throws Exception {
  399.       this.fRootElement = true;
  400.       if (this.fNodeExpansion == 0) {
  401.          this.fNodeStack.push(this.fCurrentNode);
  402.          String var10 = this.fStringPool.toString(var1);
  403.          AttributeList var11 = this.fAttrPool.getAttributeList(var2);
  404.          Element var12 = this.fDocument.createElement(var10);
  405.          int var6 = var11.getLength();
  406.  
  407.          for(int var7 = 0; var7 < var6; ++var7) {
  408.             var12.setAttribute(var11.getName(var7), var11.getValue(var7));
  409.          }
  410.  
  411.          this.fCurrentNode.appendChild(var12);
  412.          this.fCurrentNode = var12;
  413.          this.fWithinElement = true;
  414.          if (this.fDocumentImpl != null) {
  415.             for(int var8 = this.fAttrPool.getFirstAttr(var2); var8 != -1; var8 = this.fAttrPool.getNextAttr(var8)) {
  416.                if (this.fAttrPool.getAttType(var8) == 1) {
  417.                   String var9 = this.fStringPool.toString(this.fAttrPool.getAttValue(var8));
  418.                   this.fDocumentImpl.putIdentifier(var9, var12);
  419.                }
  420.             }
  421.          }
  422.  
  423.          this.fAttrPool.releaseAttrList(var2);
  424.       } else {
  425.          if (this.fNodeExpansion == 1) {
  426.             this.push(this.fCurrentNodeIndex);
  427.             int var3 = this.fDeferredDocumentImpl.createElement(var1, var2);
  428.             this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var3);
  429.             this.fCurrentNodeIndex = var3;
  430.             this.fWithinElement = true;
  431.  
  432.             for(int var4 = this.fAttrPool.getFirstAttr(var2); var4 != -1; var4 = this.fAttrPool.getNextAttr(var4)) {
  433.                if (this.fAttrPool.getAttType(var4) == 1) {
  434.                   int var5 = this.fAttrPool.getAttValue(var4);
  435.                   this.fDeferredDocumentImpl.putIdentifier(var5, var3);
  436.                }
  437.             }
  438.          }
  439.  
  440.       }
  441.    }
  442.  
  443.    public void endElement(int var1) throws Exception {
  444.       if (this.fNodeExpansion == 0) {
  445.          this.fCurrentNode = (Node)this.fNodeStack.pop();
  446.          this.fWithinElement = false;
  447.       } else {
  448.          if (this.fNodeExpansion == 1) {
  449.             this.fCurrentNodeIndex = this.nodestack[--this.stacktop];
  450.             this.fWithinElement = false;
  451.          }
  452.  
  453.       }
  454.    }
  455.  
  456.    public void startEntityReference(int var1) throws Exception {
  457.       if (!this.fExpandEntityReferences) {
  458.          int var2 = this.fEntityPool.getEntityName(var1);
  459.          if (var2 != this.fAmpIndex && var2 != this.fGtIndex && var2 != this.fLtIndex && var2 != this.fAposIndex && var2 != this.fQuotIndex) {
  460.             if (this.fNodeExpansion == 0) {
  461.                this.fNodeStack.push(this.fCurrentNode);
  462.                EntityReference var4 = this.fDocument.createEntityReference(this.fStringPool.toString(var2));
  463.                if (var4 != null) {
  464.                   this.fNodeStack.push(var4);
  465.                   this.fCurrentNode.appendChild(var4);
  466.                   this.fCurrentNode = var4;
  467.                }
  468.             } else {
  469.                if (this.fNodeExpansion == 1) {
  470.                   this.push(this.fCurrentNodeIndex);
  471.                   int var3 = this.fDeferredDocumentImpl.createEntityReference(var1);
  472.                   this.push(var3);
  473.                   this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var3);
  474.                   this.fCurrentNodeIndex = var3;
  475.                }
  476.  
  477.             }
  478.          }
  479.       }
  480.    }
  481.  
  482.    public void endEntityReference(int var1) throws Exception {
  483.       if (!this.fExpandEntityReferences) {
  484.          int var2 = this.fEntityPool.getEntityName(var1);
  485.          if (var2 != this.fAmpIndex && var2 != this.fGtIndex && var2 != this.fLtIndex && var2 != this.fAposIndex && var2 != this.fQuotIndex) {
  486.             if (this.fNodeExpansion == 0) {
  487.                if (this.fDocumentImpl != null) {
  488.                   NodeImpl var3 = (NodeImpl)this.fNodeStack.pop();
  489.                   this.fCurrentNode = (NodeImpl)this.fNodeStack.pop();
  490.                   if (var3.getNodeType() != 5) {
  491.                      return;
  492.                   }
  493.  
  494.                   NamedNodeMap var4 = this.fDocumentType.getEntities();
  495.                   String var5 = this.fStringPool.toString(var2);
  496.                   Node var6 = var4.getNamedItem(var5);
  497.                   if (var6 == null || var6.hasChildNodes()) {
  498.                      return;
  499.                   }
  500.  
  501.                   Entity var7 = (Entity)var6;
  502.                   if (var3.hasChildNodes()) {
  503.                      NodeList var8 = var3.getChildNodes();
  504.                      int var9 = var8.getLength();
  505.  
  506.                      for(int var10 = 0; var10 < var9; ++var10) {
  507.                         Node var11 = var8.item(var10).cloneNode(true);
  508.                         var7.appendChild(var11);
  509.                      }
  510.  
  511.                      return;
  512.                   }
  513.                }
  514.             } else if (this.fNodeExpansion == 1) {
  515.                String var12 = this.fStringPool.toString(var2);
  516.                int var13 = this.nodestack[--this.stacktop];
  517.                this.fCurrentNodeIndex = this.nodestack[--this.stacktop];
  518.                if (this.fDeferredDocumentImpl.getNodeType(var13) != 5) {
  519.                   return;
  520.                }
  521.  
  522.                var13 = this.fDeferredDocumentImpl.getFirstChild(var13);
  523.                if (this.fDocumentTypeIndex != -1) {
  524.                   int var15;
  525.                   for(var15 = this.fDeferredDocumentImpl.getFirstChild(this.fDocumentTypeIndex); var15 != -1 && (this.fDeferredDocumentImpl.getNodeType(var15) != 6 || !this.fDeferredDocumentImpl.getNodeNameString(var15).equals(var12)); var15 = this.fDeferredDocumentImpl.getNextSibling(var15)) {
  526.                   }
  527.  
  528.                   if (var15 != -1 && this.fDeferredDocumentImpl.getFirstChild(var15) == -1) {
  529.                      this.fDeferredDocumentImpl.setAsFirstChild(var15, var13);
  530.                   }
  531.                }
  532.             }
  533.  
  534.          }
  535.       }
  536.    }
  537.  
  538.    public void characters(int var1, boolean var2) throws Exception {
  539.       if (this.fNodeExpansion == 0) {
  540.          Object var5 = null;
  541.          if (var2) {
  542.             var5 = this.fDocument.createCDATASection(this.fStringPool.orphanString(var1));
  543.          } else {
  544.             Object var4 = null;
  545.             if (this.fWithinElement && this.fCurrentNode.getNodeType() == 1) {
  546.                Node var7 = this.fCurrentNode.getLastChild();
  547.                if (var7 != null && var7.getNodeType() == 3) {
  548.                   ((Text)var7).appendData(this.fStringPool.orphanString(var1));
  549.                   return;
  550.                }
  551.             }
  552.  
  553.             var5 = this.fDocument.createTextNode(this.fStringPool.orphanString(var1));
  554.          }
  555.  
  556.          if (var5 != null) {
  557.             this.fCurrentNode.appendChild((Node)var5);
  558.          }
  559.       } else {
  560.          if (this.fNodeExpansion == 1) {
  561.             int var3 = var2 ? this.fDeferredDocumentImpl.createCDATASection(var1) : this.fDeferredDocumentImpl.createTextNode(var1, false);
  562.             this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var3);
  563.          }
  564.  
  565.       }
  566.    }
  567.  
  568.    public void ignorableWhitespace(int var1, boolean var2) throws Exception {
  569.       if (this.fNodeExpansion == 0) {
  570.          Object var4 = null;
  571.          if (var2) {
  572.             var4 = this.fDocument.createCDATASection(this.fStringPool.orphanString(var1));
  573.          } else {
  574.             var4 = this.fDocument.createTextNode(this.fStringPool.orphanString(var1));
  575.          }
  576.  
  577.          if (var4 != null) {
  578.             if (this.fDocumentImpl != null) {
  579.                ((TextImpl)var4).setIgnorableWhitespace(true);
  580.             }
  581.  
  582.             this.fCurrentNode.appendChild((Node)var4);
  583.          }
  584.       } else {
  585.          if (this.fNodeExpansion == 1) {
  586.             int var3 = var2 ? this.fDeferredDocumentImpl.createCDATASection(var1) : this.fDeferredDocumentImpl.createTextNode(var1, true);
  587.             this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var3);
  588.          }
  589.  
  590.       }
  591.    }
  592.  
  593.    public void processingInstruction(int var1, int var2) throws Exception {
  594.       if (this.fNodeExpansion == 0) {
  595.          String var6 = this.fStringPool.orphanString(var1);
  596.          String var4 = this.fStringPool.orphanString(var2);
  597.          ProcessingInstruction var5 = this.fDocument.createProcessingInstruction(var6, var4);
  598.          this.fCurrentNode.appendChild(var5);
  599.       } else {
  600.          if (this.fNodeExpansion == 1) {
  601.             int var3 = this.fDeferredDocumentImpl.createProcessingInstruction(var1, var2);
  602.             this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var3);
  603.          }
  604.  
  605.       }
  606.    }
  607.  
  608.    public void comment(int var1) throws Exception {
  609.       if (this.fNodeExpansion == 0) {
  610.          Comment var3 = this.fDocument.createComment(this.fStringPool.orphanString(var1));
  611.          this.fCurrentNode.appendChild(var3);
  612.       } else {
  613.          if (this.fNodeExpansion == 1) {
  614.             int var2 = this.fDeferredDocumentImpl.createComment(var1);
  615.             this.fDeferredDocumentImpl.appendChild(this.fCurrentNodeIndex, var2);
  616.          }
  617.  
  618.       }
  619.    }
  620.  
  621.    public void characters(char[] var1, int var2, int var3, boolean var4) throws Exception {
  622.    }
  623.  
  624.    public void ignorableWhitespace(char[] var1, int var2, int var3, boolean var4) throws Exception {
  625.    }
  626.  
  627.    private void push(int var1) {
  628.       if (this.stacktop == this.nodestack.length) {
  629.          int[] var2 = new int[this.stacktop * 2];
  630.          System.arraycopy(this.nodestack, 0, var2, 0, this.stacktop);
  631.          this.nodestack = var2;
  632.       }
  633.  
  634.       this.nodestack[this.stacktop++] = var1;
  635.    }
  636.  
  637.    private int pop() {
  638.       return this.nodestack[--this.stacktop];
  639.    }
  640.  
  641.    public void parse(InputSource var1) throws SAXException, IOException {
  642.       this.fRootElement = false;
  643.       super.parse(var1);
  644.       if (!this.fRootElement) {
  645.          try {
  646.             ((XMLParser)this).error(118);
  647.          } catch (Exception var3) {
  648.             throw new SAXException(var3);
  649.          }
  650.       }
  651.    }
  652.  
  653.    // $FF: synthetic method
  654.    static Class class$(String var0) {
  655.       try {
  656.          return Class.forName(var0);
  657.       } catch (ClassNotFoundException var2) {
  658.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  659.       }
  660.    }
  661.  
  662.    static {
  663.       DEFAULT_DOCUMENT_CLASS = (class$com$ibm$xml$dom$DocumentImpl != null ? class$com$ibm$xml$dom$DocumentImpl : (class$com$ibm$xml$dom$DocumentImpl = class$("com.ibm.xml.dom.DocumentImpl"))).getName();
  664.    }
  665. }
  666.